Assistant Conversation APIs PRO
The Conversation APIs are used to start, control, and present a system-hosted Assistant chat session. A conversation corresponds to a fully managed chat page, where Scripting handles the UI, streaming output, provider selection, and message lifecycle.
Key differences from other Assistant APIs:
- Conversation APIs are designed for interactive chat experiences
- UI, streaming, and message handling are managed by the system
- Developers control when the conversation starts, ends, and is shown
Conversation Lifecycle
A typical conversation follows this lifecycle:
startConversation— create a conversation (optionally auto-start)present— display the Assistant chat page- User interacts with the Assistant
dismiss— temporarily hide the chat page (conversation continues)present— show the same conversation againstopConversation— terminate the conversation and release resources
Important rules:
- Only one active conversation can exist at a time
- Calling
startConversationwhile a conversation is active throws an error - Calling
stopConversationautomatically callsdismiss
startConversation
API Definition
Parameters
options.message
- Type:
string - Required
- The initial user message of the conversation
- Equivalent to the first user input in the chat UI
options.images (optional)
-
Type:
UIImage[] -
Sent together with the initial message
-
Common use cases:
- Image analysis
- Starting a conversation from a photo or screenshot
options.autoStart (optional)
- Type:
boolean - Default:
false
Behavior:
-
true- The assistant immediately starts generating a reply
-
false- The conversation is created but not sent automatically
- Typically used when the user should press “Send” manually
options.systemPrompt (optional)
- Type:
string
Behavior:
-
If omitted:
- The built-in Scripting Assistant system prompt is used
- Assistant Tools are available
-
If provided:
- Fully replaces the default system prompt
- Assistant Tools are disabled
Typical use cases:
- Creating a highly customized chat role
- Running the model without any tool access
options.modelId (optional)
- Type:
string - Specifies the model to use for this conversation
- Users may still change the model in the chat UI (if allowed)
options.provider (optional)
- Type:
Provider - Specifies the default provider for the conversation
- Users may change the provider in the chat UI (if allowed)
Return Value
- Resolves when the conversation is successfully created
- Rejects if a conversation already exists
present
API Definition
Behavior
-
Presents the Assistant chat page for the current conversation
-
If the page is already presented, calling this has no effect
-
Can be called:
- After
startConversation - After
dismissto re-present the same conversation
- After
Return Value
- Resolves when the chat page is dismissed by the user
dismiss
API Definition
Behavior
- Dismisses the Assistant chat page
- Does not stop the conversation
- Conversation state and history are preserved
Typical use cases:
- Temporarily hiding the chat UI
- Navigating to another page or task
Return Value
stopConversation
API Definition
Behavior
- Fully terminates the current conversation
- Automatically calls
dismiss - Cleans up conversation state and resources
- After calling this, a new conversation may be started
Return Value
Conversation State Flags
Assistant.isAvailable
- Indicates whether the current user has access to the Assistant
- If
false, all Conversation APIs are unavailable
Assistant.isPresented
- Indicates whether the Assistant chat page is currently presented
Assistant.hasActiveConversation
- Indicates whether there is an active conversation
- Commonly used to guard against duplicate
startConversationcalls
Examples
Example 1: Typical usage
Example 2: Create a conversation without auto-sending
Example 3: Dismiss and re-present the same conversation
Example 4: Stop the current conversation and start a new one
Best Practices
-
Treat Conversation APIs as a managed chat UI
-
Do not mix Conversation APIs with
requestStreamingin the same flow -
Always check
hasActiveConversationbefore callingstartConversation -
For one-shot or data-oriented tasks, prefer:
requestStructuredDatarequestStreaming
-
Use Conversation APIs when continuous user interaction is required
Design Boundaries
- Conversation APIs are not suitable for headless or background tasks
- Not intended for fully automated workflows
- Not ideal when you need strict control over prompts, tokens, or output format
